package com.example.net.Dao

import android.content.Context
import androidx.room.Database
import androidx.room.DatabaseConfiguration
import androidx.room.InvalidationTracker
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.sqlite.db.SupportSQLiteOpenHelper
import com.example.net.entity.RecommonVideoEntity
import com.example.net.entity.SimpleVideoEntity

@Database(entities = [RecommonVideoEntity::class],version = 1)
abstract class DataBase:RoomDatabase() {
	abstract fun videoDao():VideoDao
	
	companion object{
		@Volatile
		private var INSTANCE:DataBase? = null
		
		fun getDataBase(context: Context):DataBase{
			return INSTANCE?: synchronized(this){
				val instance =Room .databaseBuilder(context.applicationContext,DataBase::class.java,"video_db").build()
				INSTANCE = instance
				instance
			}
		}
	}
}